package com.adong.test;

import com.adong.aop.Calculate;
import com.adong.config.AopConfig;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author adong
 */
public class AopDemo {
    @Test
    public void demo() {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AopConfig.class);
        /*不要自己创建要不然没有作用,要让spring容器帮你完成
       Calculate calculate = new Calculate();
        calculate.add(1,2);*/
        Calculate calculate = applicationContext.getBean("calculate", Calculate.class);
        calculate.add(1, 2);
    }
}
